home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 10.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  5.0 KB  |  256 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. j=0
  20. TFrames = Frames
  21. if Field = 1 then TFrames = Frames*2
  22. do i = 1 to Frames
  23.     call open TempFile,"RAM:VFXNums",W
  24.     call writeln TempFile,right(i,5,'0')
  25.     call writeln TempFile,right(Frames,5,'0')
  26.     call close TempFile
  27.     f=0
  28.     Redraw Off
  29.     FieldSet = 0
  30.     if Padding ~= -1 & i = 1 then call PadIt(1)
  31.     call LoadB()
  32.     call LoadA()
  33.     j = j+ 1
  34.     call DoIt()
  35.     Redraw On
  36.     call SaveIt()
  37.         if Field = 1 then do
  38.             Redraw Off
  39.             FieldSet = 1
  40.             call LoadB()
  41.             call LoadA()
  42.             j = j + 1
  43.             call DoIt()
  44.             Redraw On
  45.             call SaveIt()
  46.             end 
  47.     if Padding ~= -1 & i = Frames then call PadIt(2)
  48.     end
  49.     if SaveType = 0 then do
  50.         if Padding = -1 then
  51.             call MakeIcon(SaveName,(Frames-10))
  52.         else
  53.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  54.         end
  55.     Undo On
  56. exit
  57.  
  58.  
  59. PadIt:
  60. arg PadNum
  61.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  62.         Undo On
  63.         exit
  64.         end
  65.          if PadNum = 1 then do
  66.        if IAType = 0 then do
  67.         do Pad = Padding to 1 by -1
  68.             LoadBuffer PicAName Force StartA-(Pad-1)
  69.             call Switcher(TOSW)
  70.             call Switcher(MDV1)
  71.             Render Go
  72.                 call RecordAdd(SaveName,2,6,Compression)
  73.             end
  74.         end
  75.        if IAType = 1 then do
  76.         LoadBuffer PicAName Force 1
  77.         call Switcher(TOSW)
  78.         call Switcher(MDV1)
  79.         Render Go
  80.             call RecordAdd(SaveName,2*Padding,6,Compression)
  81.         end
  82.        if IAType = 2 then do
  83.         LoadBuffer PicAName Force
  84.         call Switcher(TOSW)
  85.         call Switcher(MDV1)
  86.         Render Go
  87.             call RecordAdd(SaveName,2*Padding,6,Compression)
  88.         end
  89.        if IAType = 3 then do
  90.         do Pad = Padding to 1 by -1
  91.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  92.             call Switcher(TOSW)
  93.             call Switcher(MDV1)
  94.             Render Go
  95.                 call RecordAdd(SaveName,2,6,Compression)
  96.             end
  97.         end
  98.     end 
  99.     else do
  100.        if IBType = 0 then do
  101.         do Pad = 1 to Padding
  102.             LoadBuffer PicBName Force StartB+Pad+Frames
  103.             call Switcher(TOSW)
  104.             call Switcher(MDV1)
  105.             Render Go
  106.                 call RecordAdd(SaveName,2,6,Compression)
  107.             end
  108.         end
  109.        if IBType = 1 then do
  110.         LoadBuffer PicBName Force 1
  111.         call Switcher(TOSW)
  112.         call Switcher(MDV1)
  113.         Render Go
  114.             call RecordAdd(SaveName,2*Padding,6,Compression)
  115.         end
  116.        if IBType = 2 then do
  117.         LoadBuffer PicBName Force
  118.         call Switcher(TOSW)
  119.         call Switcher(MDV1)
  120.         Render Go
  121.             call RecordAdd(SaveName,2*Padding,6,Compression)
  122.         end
  123.        if IBType = 3 then do
  124.         do Pad = 1 to Padding
  125.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  126.             call Switcher(TOSW)
  127.             call Switcher(MDV1)
  128.             Render Go
  129.                 call RecordAdd(SaveName,2,6,Compression)
  130.             end
  131.         end
  132.     end
  133. return
  134.  
  135. LoadA:
  136.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  137.         Undo On
  138.         exit
  139.         end
  140.     if j = TFrames then return
  141.     if IAType = 0 then do
  142.         LoadBuffer PicAName Force i+StartA
  143.         end
  144.     if IAType = 1 then do
  145.         LoadBuffer PicAName Force 1
  146.         end
  147.     if IAType = 2 then do
  148.         LoadBuffer PicAName Force
  149.         end
  150.     if IAType = 3 then do
  151.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  152.         end
  153.  
  154. return
  155.  
  156. LoadB:
  157.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  158.         Undo On
  159.         exit
  160.         end
  161.     if j = 1 then return
  162.     if IBType = 0 then do
  163.         LoadBuffer PicBName Force i+StartB
  164.         end
  165.     if IBType = 1 then do
  166.         LoadBuffer PicBName Force 1
  167.         end
  168.     if IBType = 2 then do
  169.         LoadBuffer PicBName Force
  170.         end
  171.     if IBType = 3 then do
  172.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  173.         end
  174.     Swap
  175. return
  176.  
  177.  
  178. DoIt:
  179.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  180.         Undo On
  181.         exit
  182.         end
  183.     if j = TFrames then do
  184.         Swap
  185.         return
  186.         end
  187.     if j = 1 then do
  188.         GetMain
  189.         parse var result Name Width Height Blah
  190.         return
  191.         end
  192.  
  193.  
  194.     Num = (((j-1) * 100)/(TFrames-1))
  195.     Num = trunc(Num)
  196.     Hook Composite MERGE Num 1 0 0 MatchMain SwapScale
  197.  
  198.     Num = (((j-1) * 360)/(TFrames-1))
  199.     NewNum1 = trunc(Num)
  200.  
  201.     ByNum = Width - Width/4
  202.     NewNum = ((j-1)*ByNum)/((TFrames/2)-1)
  203.     if j > (TFrames/2) then
  204.         NewNum = ((ByNum -(((j-1) * ByNum)/(TFrames-1)))%1)*2
  205.     NewNum2 = trunc(NewNum)
  206.  
  207.     Hook PolarMosaic 36 20 NewNum1 0 Width/2 Height/2 NewNum2 0 NoPrep
  208.  
  209.  
  210.  
  211. return
  212.  
  213.  
  214.  
  215.  
  216. SaveIt:
  217.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  218.         Undo On
  219.         exit
  220.         end
  221.     if SaveType = 0 then do
  222.         call Switcher(TOSW)
  223.         call Switcher(MDV1)
  224.  
  225.         Render Go
  226.         if Field = 1 then
  227.                 call RecordAdd(SaveName,1,6,Compression)
  228.         else
  229.                 call RecordAdd(SaveName,2,6,Compression)
  230.         end
  231.  
  232.     if SaveType = 1 then do
  233.         if Field = 1 then do
  234.             f= f + 1
  235.             if f = 1 then
  236.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  237.             if f = 2 then do
  238.                 GetMain
  239.                 parse var result Name Width Height Blah
  240.                 Scale Width Height/2
  241.                 Swap
  242.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  243.                 Scale Width Height/2
  244.                 Hook Interlace
  245.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  246.                 f = 0
  247.                 end
  248.             end
  249.         else do
  250.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  251.             end    
  252.         end
  253. return
  254.  
  255.  
  256.